import {SHOW_PAGE_FUN} from "@/views/securityCheck/defectQuestion/infoPage/subPage/config";
import {LIST_PAGE_FUN} from "@/views/securityCheck/defectQuestion/listPage/subPage/config";
import {isArr} from "@/utils/arrayUtil";

const subShowPageMixins = {
  props: {
    inspectInfo: {
      type: Object,
      default: () => {
        return {
          currentId:null
        }
      }
    },
    nodeSerialNo:{
      type: [String, Number]
    },
    instanceNo:{
      type: [String, Number]
    },
    handelCode: {
      type: [String, Number]
    },
    currentPageName: {
      type: String
    }
  },
  data() {
    return {
      showGoBack: false,
      SHOW_PAGE_FUN
    }
  },
  methods:{
    getBtList(subType) {
      let {currentPageName, handelCode} = this
      let btItem = SHOW_PAGE_FUN[currentPageName]
      if (btItem == null) return [];
      let btList = btItem[subType];
      return isArr(btList) ? btList : []
    },
    clickHandel({fun}, param) {
      if (!this[fun] || typeof this[fun] !== 'function') return;
      this[fun](param)
    },
  },
  created() {
    this.currentId = this.$route.query?.id
    this.getInfoData()
  }
}

export {subShowPageMixins}
